{# What is in the cache, grouped by what it is for (``ui_cache``). Hits and misses count the process serving this page; with Redis the entries are shared, the counts are not. #} {% from "components/macros/layout.html" import card, stats_strip, progress, badge %} {% from "components/macros/table.html" import data_table %} {% from "components/macros/feedback.html" import empty_state %} {% macro share(value) %}{{ progress(value, "ok", size="h-1.5") }}{{ (value * 100)|round(1) }}%{% endmacro %} {% from "pages/overseer/_macros.html" import named %} {% macro what(group) %}{{ named(group.name, group.about, mono=not group.family) }}{% endmacro %} {% macro rate(value) %}{% if value is none %}-{% else %}{{ badge(value ~ "%", "ok" if value >= 80 else ("warn" if value >= 50 else "error")) }}{% endif %}{% endmacro %} {% if cache.error %} {% else %}
{{ stats_strip(cache.figures, id="cache-figures") }}

Backend: {{ "Redis (shared by every process)" if cache.backend == "redis" else "memory (this process only)" }}

{% if not cache.groups %} {{ empty_state("The cache is empty", "Services put values here with app.core.cache; they appear once something is cached.") }} {% else %} {% call card("What it holds", "By room taken", id="cache-families") %} {{ data_table([ {"key": "name", "label": "Kind", "render": what, "row": true}, {"key": "keys", "label": "Keys", "kind": "int", "align": "right"}, {"key": "size", "label": "Size", "align": "right"}, {"key": "share", "label": "Share", "render": share}, {"key": "ttl_label", "label": "Avg time left"}, {"key": "hit_rate", "label": "Hit rate", "render": rate}, ], cache.groups) }} {% endcall %} {% call card("Largest keys", id="cache-largest") %} {{ data_table([ {"key": "key", "label": "Key", "kind": "code"}, {"key": "group", "label": "Kind"}, {"key": "size", "label": "Size", "align": "right"}, {"key": "ttl_label", "label": "Time left"}, ], cache.largest) }} {% endcall %} {% endif %}
{% endif %}